# Copyright 2007, Timothy Appnel, Appnel Internet
# Solutions, LLC, tim@appnel.com. All rights reserved.

package MT::Plugin::Defensio;
use strict;

sub init_app {
    my ($plugin) = @_;
    unless (MT->version_number > 4.02) {
        if (my $r = $plugin->registry('settings'))
        {    # read settings from YAML 4.01 compatability.
            my $settings = [];
            for my $s (sort keys %$r) {
                my @set;
                push @set, $s;
                if (defined $r->{$s}) {
                    my $attr = {};
                    $attr->{Default} = $r->{$s}->{default}
                      if defined $r->{$s}->{default};
                    $attr->{Scope} = $r->{$s}->{scope}
                      if defined $r->{$s}->{scope};
                    push @set, $attr;
                }
                push @$settings, \@set;
            }
            $plugin->settings(MT::PluginSettings->new($settings));
        }
    }
}

1;
